package WaiBao;

import java.util.Arrays;

public class LiKe {
    public static void main(String[] args) {
        String[] name= {"韩信(班长)", "韩星(副班长)", "小李(学习委员)", "韩雪(组织委员)", "李洪海", "韩景亮", "邯钢", "韩文强", "韩勋", "韩旭", "张旭", "张九龄",
                "张海自", "王自力", "王自立", "王约翰", "求伯君", "邱仑", "求轮", "杨铁柱", "杨到到", "李叨叨", "李金良", "李景亮", "王涛", "王海东", "王体文", "余慧慧",
                "杜海涛", "李珂(学生)"};//考生本人:李珂(学生)
        int[] age = {20, 18,19,21,20, 22, 21,22,18,20,19,19,20, 19, 21,20,20, 19, 20, 19, 19,21, 21, 21, 20, 23, 19,22,21, 19};//考生年龄：19岁

        double[] dump1 = {70, 66, 84, 79, 77, 79, 75, 85, 73, 80, 64, 72, 71, 79, 65, 78, 62, 90, 86, 88, 92, 91, 95, 88, 75, 74, 78, 72, 84, 96};
        double[] dump2 = {84, 71, 74, 81, 89, 77, 73, 89, 70, 74, 85, 70, 85, 94, 90, 74, 74, 79, 64, 65, 91, 71, 96, 85, 88, 85, 71, 94, 81, 95};
        double[] dump3 = {77, 84, 74, 83, 71, 61, 78, 80, 84, 60, 63, 80, 75, 75, 95, 68, 69, 69, 96, 93, 92, 81, 95, 95, 79, 84, 77, 61, 90, 96};


        double xiang1;//代表每个学生的总分
        double xiang2;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            xiang1 = dump1[i] +dump2[i] +dump3[i];
//            xiang2 = ( xiang1 * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" +xiang1);
//            System.out.println(name[i] + "的平均分为:" +xiang2);
//        }



        double dida1 = 0,dida2 = 0;
        double[] weisheng = new double[30];
//        for (int i = 0; i < 30; i++) {
//            dida1 = dump1[i] + dump2[i] + dump3[i];
//            dida2= (dida1 * 1.0) / 3;
//            weisheng[i] = dida2;
//        }
//
//        for (int i = 0; i <weisheng.length - 1; i++) {
//            for (int j = 0; j < weisheng.length - i - 1; j++) {
//                if (weisheng[j] < weisheng [j + 1]) {
//                    double tep =weisheng[j];
//                    weisheng[j] =weisheng[j + 1];
//                    weisheng[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(weisheng[i]);
//        }


        double zhenzhu1 = 0,zhenzhu2 = 0,zhenzhu3 = 0;//计算每门课的平均分
        double meiyou1 = 0,meiyou2 = 0, meiyou3 = 0;//计算每门课标准差
        double xingzi1 = 0,xingzi2 = 0,xingzi3 = 0;//计算每门课中位数
        double sum2 = 0;
        for (int i = 0; i < dump1.length; i++) {
            sum2+=dump1[i];
        }
        zhenzhu1 = (sum2*1.0)/30;
        System.out.println("生物化学的班级平均分为:"+zhenzhu1);
        double Sum = 0;
        for (int i = 0; i <dump2.length; i++) {
            Sum+=dump2[i];
        }
        zhenzhu2 = (Sum*1.0)/30;
        System.out.println("微生物学的班级平均分为:"+zhenzhu2);
        double sum = 0;
        for (int i = 0; i <dump3.length; i++) {
            sum+=dump3[i];
        }
        zhenzhu3 = (sum*1.0)/30;
        System.out.println("人体组织解剖学的班级平均分为:"+ zhenzhu3);


//
        double c1 = 0,c2 = 0,c3 = 0;
//        for (int i = 0; i < dump1.length; i++) {
//            c1+= (dump1[i] -zhenzhu1)*(dump1[i] -zhenzhu1);
//        }
//        meiyou1 = Math.sqrt(c1*1.0/30);
//        System.out.println("生物化学的班级标准差为:"+meiyou1);
//
//        for (int i = 0; i <dump2.length; i++) {
//            c2+= (dump2[i] -zhenzhu2)*(dump2[i] - zhenzhu2);
//        }
//        meiyou2 = Math.sqrt(c2*1.0/30);
//        System.out.println("微生物学的班级标准差为:"+meiyou2);
//
//        for (int i = 0; i < dump3.length; i++) {
//            c3+= (dump3[i] -zhenzhu3)*(dump3[i] -zhenzhu3);
//        }
//        meiyou3 = Math.sqrt(c3*1.0/30);
//        System.out.println("人体组织解剖学的班级标准差为:"+meiyou3);
////
////
        Arrays.sort(dump1);
        Arrays.sort(dump2);
        Arrays.sort(dump3);
        xingzi1 =(dump1[14]+dump1[15])*1.0/2;
        xingzi2 =(dump2[14]+dump2[15])*1.0/2;
        xingzi3 =(dump3[14]+dump3[15])*1.0/2;
        System.out.println("生物化学的中位数为:"+xingzi1);
        System.out.println("微生物学的中位数为:"+xingzi2);
        System.out.println("人体组织解剖学的中位数为:"+xingzi3);


    }
}
